package org.example.demo.service.userService.impl;

import org.example.demo.dto.UserMessageParam;
import org.example.demo.service.userService.MessageService;
import org.example.mbg.mapper.MessageMapper;
import org.example.mbg.model.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    MessageMapper messageMapper;

    public String UploadMessage(UserMessageParam userMessageParam) {
        Message message1 = new Message();
        message1.setUserId(userMessageParam.getUser_id());
        message1.setShopId(userMessageParam.getShop_id());
        message1.setProductId(userMessageParam.getProduct_id());
        message1.setMessage(userMessageParam.getMessage());
        message1.setMessageTime(new Date());

        messageMapper.insertSelective(message1);
        return "ok";
    }
}
